Skip to content

DialogMixin

Sub classes

Name Children Inherits
Dialog
prettyqt.widgets.dialog
The base class of dialog windows.
MessageBox
prettyqt.widgets.messagebox
Modal dialog for informing the user (and for receiving an answer).
ErrorMessage
prettyqt.widgets.errormessage
Error message display dialog.
    ProgressDialog
    prettyqt.widgets.progressdialog
    Feedback on the progress of a slow operation.
      FontDialog
      prettyqt.widgets.fontdialog
      Dialog widget for selecting a font.
        FileDialog
        prettyqt.widgets.filedialog
        Dialog that allow users to select files or directories.
          ColorDialog
          prettyqt.widgets.colordialog
          Dialog widget for specifying colors.
            InputDialog
            prettyqt.widgets.inputdialog
            Simple convenience dialog to get a single value from the user.
              WizardMixin
              prettyqt.widgets.wizard
              AbstractPrintDialogMixin
              prettyqt.printsupport.abstractprintdialog
              PageSetupDialog
              prettyqt.printsupport.pagesetupdialog
              Configuration dialog for the page-related options on a printer.
                PrintPreviewDialog
                prettyqt.printsupport.printpreviewdialog
                Dialog for previewing and configuring page layouts for printer output.

                  Base classes

                  Name Children Inherits
                  WidgetMixin
                  prettyqt.widgets.widget
                  object
                  builtins
                  The base class of the class hierarchy.
                  • type
                  • async_generator
                  • bytearray_iterator
                  • bytearray
                  • bytes_iterator
                  • bytes
                  • builtin_function_or_method
                  • callable_iterator
                  • PyCapsule
                  • cell
                  • classmethod_descriptor
                  • ...

                    ⋔ Inheritance diagram

                    graph TD
                      2345124717["widgets.DialogMixin"]
                      829357528["widgets.WidgetMixin"]
                      3227531497["core.ObjectMixin"]
                      2751680898["builtins.object"]
                      625385617["gui.PaintDeviceMixin"]
                      829357528 --> 2345124717
                      3227531497 --> 829357528
                      2751680898 --> 3227531497
                      625385617 --> 829357528
                      2751680898 --> 625385617
                      2751680898 --> 829357528
                      2751680898 --> 2345124717

                    🛈 DocStrings

                    Bases: WidgetMixin, _DialogBase

                    Source code in prettyqt/widgets/dialog.py
                    class DialogMixin(widgets.WidgetMixin, _DialogBase):
                        def __init__(
                            self,
                            *args,
                            delete_on_close: bool = False,
                            **kwargs,
                        ):
                            super().__init__(*args, **kwargs)
                            if delete_on_close:
                                self.delete_on_close()
                    
                        def keyPressEvent(self, e):
                            match e.key():
                                case constants.Key.Key_Escape:
                                    self.close()
                                case constants.Key.Key_F11 if self.isMaximized():
                                    self.showNormal()
                                case constants.Key.Key_F11:
                                    self.showMaximized()
                                case _:
                                    super().keyPressEvent(e)
                    
                        def delete_on_close(self):
                            self.setAttribute(constants.WidgetAttribute.WA_DeleteOnClose)
                    
                        def add_buttonbox(self) -> widgets.DialogButtonBox:
                            button_box = widgets.DialogButtonBox.create(ok=self.accept, cancel=self.reject)
                            self.box.add(button_box)
                            return button_box
                    
                        def show_blocking(self) -> bool:
                            self.show()
                            return bool(self.exec())
                    
                        def is_accepted(self) -> bool:
                            return self.result() == widgets.QDialog.DialogCode.Accepted
                    
                        def main_loop(self) -> int:
                            return self.exec()
                    

                    :fa-brands-github: Show source on GitHub